﻿cmake_minimum_required(VERSION 3.9)
#项目名称
project(Application2)

#设置Qt库路径
set(CMAKE_PREFIX_PATH $ENV{QTDIR})

#查找Qt模块和Boost模块
find_package(Qt5 COMPONENTS Core Gui Qml Quick Widgets REQUIRED)
find_package(Boost REQUIRED)

#打开相关自动选项
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
#解决Headers(.h)和Forms(.ui)不在同一个目录下的问题
set(CMAKE_AUTOUIC_SEARCH_PATHS "FormFiles")

# 指定库文件输出目录
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin)
# 指定可执行文件输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin)

include_directories($ENV{NDDSHOME}/include)
include_directories($ENV{NDDSHOME}/include/ndds)
include_directories($ENV{ECOM_PATH}/Release)
include_directories(${Boost_INCLUDE_DIRS})
include_directories("HeaderFiles")
#设置静态库搜索目录
link_directories($ENV{NDDSHOME}/lib/i86Win32VS2010)#DDS
link_directories($ENV{BOOST_PATH}/stage/lib)#BOOST

#link_libraries(rticonnextmsgcppd.lib nddscppd.lib nddscd.lib nddscored.lib)#链接dds静态库
link_libraries(libboost_thread-vc100-mt-gd-1_58.lib)#链接boost线程库
link_libraries(Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Qml Qt5::Quick)#链接QT库

file(GLOB SOURCES "SourceFiles/*.cpp")
file(GLOB HEADERS "HeaderFiles/*.h")
file(GLOB_RECURSE FORMS "FormFiles/*.ui")
file(GLOB_RECURSE RESOURCES "Resources/*.qrc")
#生成可执行程序
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${FORMS} ${RESOURCES})